<?php

namespace App\Http\Controllers;

class PagesController extends Controller
{
    public function hermes()
    {
        $ip = $this->getFinanceServerIp();
        $url = 'http://' . $ip . ':8097';
        return redirect($url);
    }

    public function clickhouseTab()
    {
        $ip = $this->getFinanceServerIp();
        $url = 'http://' . $ip . ':8124';
        return redirect($url);
    }

    public function getFinanceServerIp()
    {
        $redis = new \Predis\Client();
        $redis->auth(env('REDIS_PASSWORD'));
        return $redis->get('finance_server_ip') ?? null;
    }
}
